Do you regularly export your wiki to HTML? Do you ever wonder what a particular page looks like after it has been exported? Are you frustrated by the formatted filenames VP uses to make its URLs work? Then this script is for you!
This AppleScript takes the currently visible VoodooPad page and looks for its corresponding HTML document on either the web or your local disk. Please note that you must actually export your .vdoc document somewhere first, or at least the individual page you're looking for. (to find out how to export just the current page with a proper filename, see Export Current Page )
set thePath to "http://homepage.mac.com/MYUSERNAME/wiki/" -- set this to the path of the server (or file:/// location) -- of your wiki's html export. -- Don't forget the trailing "/"tell application "VoodooPad" set thePage to "" set thePage to the name of window 1 as text if thePage = "" then set thePage to the name of window 2 as text set theDoc to the name of document 1 as text set theDoc to theDoc & ":" end tellset x to the length of theDoc repeat while thePage begins with the theDoc set thePage to characters (x + 1) thru -1 of thePage as string end repeatset the comparison_string to "ABCDEFGHIJKLMNOPQRSTUVWXYZ" set the source_string to "abcdefghijklmnopqrstuvwxyz"set the newFile to "" repeat with thisChar in thePage set x to the offset of thisChar in the comparison_string if x is not 0 then set the newFile to (the newFile & character x of the source_string) as string else set the newFile to (the newFile & thisChar) as string end if end repeatset AppleScript's text item delimiters to " " set newFile to (text items of newFile) set AppleScript's text item delimiters to "_20" set newFile to newFile as text set AppleScript's text item delimiters to "" try set newFile to (characters 1 thru 23 of newFile) end try set newFile to (thePath & newFile & ".html") as texttell application "Safari" make new document at end of documents set URL of document 1 to newFile end tell
Submitted by – mike [dot] com [at] mac [dot] com